package com.huike.contract.domain.service.lmpl;

import com.huike.business.domain.TbBusiness;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.domain.BaseEntity;
import com.huike.common.core.page.PageDomain;
import com.huike.common.exception.CustomException;
import com.huike.common.utils.DateUtils;
import com.huike.common.utils.bean.BeanUtils;
import com.huike.contract.domain.TbContract;
import com.huike.contract.domain.mapper.ContractMapper;
import com.huike.contract.domain.service.ContractService;
import com.huike.contract.domain.vo.TransferVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @Description TODO
 * @Author liu
 * @Date 2023-07-11 14:35
 */
@Service
public class ContractServicelmpl implements ContractService {
    @Resource
    private ContractMapper contractMapper;

    /**
     * 新增合同
     *
     * @param tbContract
     */
    @Override
    public void addContract(TbContract tbContract) {
        BaseEntity baseEntity=new BaseEntity();
        BeanUtils.copyProperties(baseEntity,tbContract);
        //补齐数据
        baseEntity.setCreateBy(baseEntity.getCreateBy());
        baseEntity.setCreateTime(tbContract.getCreateTime());
        contractMapper.addContract(tbContract);
    }

    /**
     * 修改合同
     *
     * @param tbContract
     */
    @Override
    public void revampContract(TbContract tbContract) {
        BaseEntity baseEntity=new BaseEntity();
        BeanUtils.copyProperties(tbContract,baseEntity);
        baseEntity.setUpdateBy(baseEntity.getUpdateBy());
        baseEntity.setUpdateTime(tbContract.getUpdateTime());
        contractMapper.revampContract(baseEntity);
    }

    /**
     * 查询合同列表
     *
     * @param tbContract
     */
    @Override
    public List<TbContract> list(TbContract tbContract) {
        return contractMapper.list(tbContract);
    }

    /**
     * 商机转合同接口
     *
     * @param tbContract
     * @param id
     */
    @Override
    public void changeContractId(TbContract tbContract, Long id) {

    }
}
